<?php

$this->load->helper('text');

$upload_url = base_url('uploads');
$error_url = base_url('error');
$css_url = base_url('css');
$js_url = base_url('js');
$main_url = base_url('main');

$other_head = "
	<link rel='stylesheet' href='$css_url/nivo.default.css' type='text/css' media='screen' />
    <link rel='stylesheet' href='$css_url/nivo.slider.css' type='text/css' media='screen' />
    <link rel='tylesheet' href='$css_url/nivo.css' type='text/css' media='screen' />
	<script type='text/javascript' src='$js_url/jquery.nivo.slider.js'></script>
	<script type='text/javascript'>
		\$jq(window).load(function() {
			\$jq('#slider').nivoSlider({
				 effect: 'random',
				 animSpeed: 800,
				 pauseTime: 4000
			});
			
			\$jq('#blogupdate').load('$main_url/blog #update');
		});
		
	
    </script>
";

if($this->agent->is_browser()){
	$other_head .= "<noscript> <meta http-equiv=\"refresh\" content=\"0; URL=$error_url/noscript.html\" /> </noscript>";
}


$lcompany = $this->mainmodel->get_usaha_terbaru();
$lproduk = $this->mainmodel->get_produk_terbaru();
$lloker = $this->mainmodel->get_loker_terbaru();
$levent = $this->mainmodel->get_acara_terbaru();

$produkbaru = "";
$usahabaru = "";
$captionusaha = "";
$lokerbaru = "";
$eventbaru = "";

if($lcompany !== FALSE)
{
	$i=1;
	$usahabaru .= "<div id='slider' class='nivoSlider'>";
	
	foreach($lcompany AS $usaha)
	{
		$judulusaha = url_title($usaha->nama, '-', TRUE); 
		$deskripsi = word_limiter(filter_var($usaha->deskripsi, FILTER_SANITIZE_STRING), 30);
		
		$usahabaru .= "
			<img src='$upload_url/perusahaan/$usaha->logo' data-thumb='$upload_url/perusahaan/$usaha->logo' alt='Gambar $i' title='#htmlcaption$i' />
		";
		$captionusaha .= "
			<div id='htmlcaption$i' class='nivo-html-caption'>
				<a href='$main_url/detail/$usaha->idperusahaan/company/$judulusaha.html'>$usaha->nama</a>  $deskripsi 
			</div>";
			
		$i++;
	}
	$usahabaru .= "</div>";
}

if($lproduk !== FALSE)
{
	
	foreach($lproduk AS $produk)
	{
		$descp = word_limiter(xss_clean($produk->deskripsi), 30);
		$titlep = url_title($produk->nama, '-', TRUE);
		
		$produkbaru .= "
			<div class='produkbaru'>
				
			";
		
		$produkbaru .="
				<a href='$main_url/detail/$produk->idproduk/produk/$titlep.html'><h5>$produk->nama</h5></a>
				<p style='clear:none; float:left; margin:5px'>
					$descp
				</p>
			</div>
			<div class='clear'></div>
		";
		
	}
}
else{
	$produkbaru = "Data Tidak ditemukan";
}



if($lloker !== FALSE)
{
	foreach($lloker AS $loker)
	{
		$descl = word_limiter(xss_clean($loker->deskripsi), 30);
		$titlel = url_title($loker->posisi, '-', TRUE);
		
		$lokerbaru .= "
			<div class='lokerbaru'>
				<a href='$main_url/detail/$loker->idjob/loker/$titlel.html'><h5>$loker->posisi</h5></a>
				<p>
					$descl
				</p>
			</div>
		";
		
	}
}
else{
	$lokerbaru = "Data Tidak ditemukan";
}

if($levent !== FALSE)
{
	foreach($levent AS $event)
	{
		$desce = word_limiter(xss_clean($event->deskripsi), 30);
		$titlee = url_title($event->nama, '-', TRUE);
		
		$eventbaru .= "
			<div class='eventbaru'>
				<a href='$main_url/detail/$event->idacara/acara/$titlee.html'><h5>$event->nama</h5></a>
				<p>
					$desce
				</p>
			</div>
		";
		
	}
}
else{
	$eventbaru = "Data Tidak ditemukan";
}


$isipage = "
	<div id='slide'>
			
			
			<div id='divContent'>
				
				<div class='slider-wrapper theme-default'>
					$usahabaru 
					$captionusaha 
				</div>
				
			</div>
			
	</div>
	
	<div class='blank'></div>
	<div class='linebrown'></div>
	
	<div id='baru'>
		
		<table>
			<tbody>
				
				<tr>
					<td id='produkbaru'>
						<div >
							<h3>Produk / Layanan</h3>
							$produkbaru
							<br />
							<a style='margin:5px' href='$main_url/produk.html'>Lihat Semua</a>
						</div>
						<div class='blank'></div>
					</td>
					
					<td id='news'>
						<div>
							<h3>Berita baru</h3>
							
							<div id='blogupdate'>
							</div>
							<br />
							<a target='_blank' style='margin:5px' href='http://blog.dadannetwork.com'>Lihat Semua</a>
						</div>
						<div class='blank'></div>
					</td>
				</tr>
				
				<tr>
					<td id='lokerbaru'>
						<h3>Lowongan Kerja Terbaru</h3>
						
						$lokerbaru
						
						<a style='margin:5px' href='$main_url/loker.html' target='_blank'>Lihat Semua</a>
					</td>
					<td id='eventbaru'>
						<h3>Daftar Event Terbaru</h3>
						
						$eventbaru
						
						<a style='margin:5px' href='$main_url/acara.html'>Lihat Semua</a>
					</td>
				</tr>
			</tbody>
		</table>
		
	</div>	
		
	<div class='blank'></div>
		
";

$data['site_title'] = 'Dadan Network';
$data['site_description'] = 'Dadan Network adalah situs berbagi informasi tentang jaringan profesional antar enterpreneur indonesia';
$data['site_keywords'] = 'dadan, network, profesional, enterpreneur, produk, usaha';
$data['base_url'] = base_url();
$data['other_head'] = $other_head;
$data['map_dir'] = '';
$data['isi_page'] = $isipage;
$data['tahun_sekarang'] = date("Y");

$this->parser->parse('template/home', $data);

/* End of file index.php */
/* Location: ./application/views/main/index.php */
